package com.nervous.jiaoli.face.tag.dao;

import com.nervous.jiaoli.face.tag.Tag;
import com.nervous.jiaoli.face.tag.TagDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TagDao {

    List<Tag> findTagList(TagDto tagDto);

    @Insert("insert into tag(t_id,t_name) values(#{t_id},#{t_name})")
    void createTag(TagDto tagDto);

    @Select("select lpad(ifnull(max(convert(substring(t_id from 10),unsigned)),0)+1,4,'0') from tag where t_id like concat(#{prefix},'%')")
    String findTagNewNum(String prefix);

    void dropTag(TagDto tagDto);

    int findCount(TagDto tagDto);
}
